/*
 * Copyright (c) 2007 Thomas Fors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// =======================================================
// 1x3 Matrix Routines
// =======================================================


// -------------------------------------------------------
// Vector1x3()
// Constructor
// -------------------------------------------------------
function Vector1x3(a11, a12, a13) {
	this.a11 = a11;
	this.a12 = a12;
	this.a13 = a13;
}

// -------------------------------------------------------
// Multiply()
// Multiplies lhs (left hand side) and vector together.
// lhs must be a scalar.
// Returns appropriate result.  This vector is not changed.
// -------------------------------------------------------
Vector1x3.prototype['Multiply'] = function (lhs) {
	// Scalar * Vector
	return new Vector1x3(  lhs*this.a11, lhs*this.a12, lhs*this.a13  );
}

// -------------------------------------------------------
// Display()
// Uses an alert box to display vector for debugging purposes
// -------------------------------------------------------
Vector1x3.prototype['Display'] = function () {
	var msg = "";
	msg += Math.round(this.a11*1000000)/1000000 + "\t";
	msg += Math.round(this.a12*1000000)/1000000 + "\t";
	msg += Math.round(this.a13*1000000)/1000000 + "\n";
	
	alert(msg);
}
